# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import time

class TutorialPipeline(object):
    def process_item(self, item, spider):
        now=time.strftime('%Y-%m-%d',time.localtime())
        fileName='dwjz'+now+'.txt'

        with open(fileName,'a') as fb:
            fb.write(item['stock_code'][0]+'\t')
            fb.write(item['stock_name'][0] + '\t')
            fb.write(item['stock_dwjz'][0] + '\t')
            fb.write(item['stock_date'][0] + '\t\n')
            #time.sleep(1)
        return item
